package demo1;

public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        System.out.println("前序遍历：");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("中序遍历：");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.println("后序遍历：");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("叶子节点数目");
        System.out.println(binaryTree.leafCouunt(root));
        System.out.println();
        System.out.println(binaryTree.leafCount2(root));
        System.out.println("第K层节点数目");
        System.out.println(binaryTree.getKLevelNodeCount(root, 3));
        System.out.println("高度：");
        System.out.println(binaryTree.getHeight(root));


    }
}
